{extend name="template/base" /}
{block name="content"}

<div class="page-container">
    <div class="toptip">
    <h2>提示：</h2>
    <p>
      增加、删除、修改、查询题库试题<br>
    </p>
</div>
<div class="cl pd-5 bg-1 bk-gray form-search">
<form class="mb-20" method="get" action="{:\\think\\Url::build($Request.action)}">
    <input type="text" class="input-text itext" placeholder="试题内容" name="p_name" value="{$Request.param.p_name}" >
	<input type='hidden' name='bankid' value='{$Request.param.bankid}'>
	<input type='hidden' name='btype' value='{$Request.param.btype}'>
    <div class="select-box sbox">
        <select name="p_status" class="select">
            <option value="0">试题状态</option>
            <option value="1a" {$Request.param.p_status=='1a' ? 'selected' : ''}>启用</option>
            <option value="0a" {$Request.param.p_status=='0a' ? 'selected' : ''}>禁用</option>
        </select>
    </div>
	
	<div class="select-box sbox">
        <select name="levels" class="select">
            <option value="0">试题难易度</option>
			<option value="1a" {$Request.param.levels=='1a' ? 'selected' : ''} >易</option>
			<option value="2a" {$Request.param.levels=='2a' ? 'selected' : ''} >中</option>
			<option value="3a" {$Request.param.levels=='3a' ? 'selected' : ''} >难</option>
        </select>
    </div>
	
    <!-- 新添加 试题类型 知识点查询 -->
    <div class="select-box sbox">
        <select name="knowstypeid" class="select">
            <option value="0">知识点</option>
            {volist name="knowslists" id="vkid"}
                <option value="{$vkid.id}" {$Request.param.knowstypeid==$vkid.id ? 'selected' : ''}>{$vkid.k_name}</option>
            {/volist}
        </select>
    </div> 
    <div class="select-box sbox">
        <select name="qbankid" class="select">
            <option value="0">试题类型</option> 
            {volist name="qbanktypelist" id="cbid"}
                <option value="{$cbid.id}" {$Request.param.qbankid==$cbid.id ? 'selected' : ''}>{$cbid.type}</option>
            {/volist}
        </select>
    </div>
    <button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i>查询</button>
</form>
</div>
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
            <!--{//tp:menu menu='addexecl' /}权限相关信息-->
			{if $qbank_type}
				{if condition="$Request.param.btype neq 1"}<!-- {//tp:menu menu="add" /} -->{/if}
				<a href="javascript:;" onclick="forbid_all('{:\\think\\Url::build(\'Questions/forbid\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="btn btn-warning radius mr-5"><i class="Hui-iconfont"></i> 禁用</a>
				<a href="javascript:;" onclick="resume_all('{:\\think\\Url::build(\'Questions/resume\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="btn btn-success radius mr-5"><i class="Hui-iconfont"></i> 恢复</a>
				<a href="javascript:;" onclick="del_all('{:\\think\\Url::build(\'Questions/delete\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="btn btn-danger radius mr-5"><i class="Hui-iconfont"></i> 删除</a>

				<a href="javascript:;" onclick="open_window('回收站','{:\\think\\Url::build(\'Questions/recyclebin\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="btn btn-secondary radius mr-5"><i class="Hui-iconfont"></i> 回收站</a>

				 <!-- <a refurl="{:\\think\\Url::build('Questions/clearQbankQuestion',['bankid'=>$Request.param.bankid,'btype'=>$Request.param.btype])}" refTxt="确定要清空该题库下所有试题吗？" class="ajax btn btn-warning radius Hui-iconfont Hui-iconfont-del3 bold">彻底清空该题库</a> -->
                        
                 <!-- <a refurl="{:\\think\\Url::build('Questions/clearQbankQuestion',['bankid'=>$Request.param.bankid,'btype'=>$Request.param.btype,'knowstypeId'=>$Request.param.knowstypeid,'qbankid'=>$Request.param.qbankid,'getq_status'=>$Request.param.p_status,'likename'=>$Request.param.p_name,'deletetype'=>1])}" refTxt="确定要清空当前筛选的{$count ?? '0'}条试题吗？" class="ajax btn btn-warning radius Hui-iconfont Hui-iconfont-del3 bold">清空当前筛选内容{$count ?? '0'}条</a> -->
                 <a onclick="delalldatalist('{:\\think\\Url::build(\'Questions/clearQbankQuestion\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="btn btn-warning radius Hui-iconfont Hui-iconfont-del3 bold">彻底清空该题库</a>

                 <a onclick="deldatalist('{:\\think\\Url::build(\'Questions/clearQbankQuestion\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype,\'knowstypeId\'=>$Request.param.knowstypeid,\'qbankid\'=>$Request.param.qbankid,\'getq_status\'=>$Request.param.p_status,\'likename\'=>$Request.param.p_name,\'deletetype\'=>1])}')"  class="btn btn-warning radius Hui-iconfont Hui-iconfont-del3 bold">清空当前筛选内容{$count ?? '0'}条</a>
			 {/if}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
          {if $qbank_type}  <th style="width: 150px;">操作</th>{/if}
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c" >
            {include file="td" /}
            {if $qbank_type}
            <td class="f-14">
            <a href="javascript:;" onclick="ajax_req('{:\\think\\Url::build(\'Questions/forbid\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype,\'id\'=>$vo.id])}',{},change_status,[this,'forbid'])" class="label label-warning radius" title="点击禁用">禁用</a>
              
                {if condition="$Request.param.btype neq 1"}

                <a title="编辑" href="javascript:;" onclick="layer_open('编辑','{:\\think\\Url::build(\'Questions/edit\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype,\'id\'=>$vo.id])}',{w:'100%',h:'100%'})" style="text-decoration:none;white-space: nowrap;" class="ml-5"><i class="Hui-iconfont"></i>&nbsp;编辑</a> 
                {/if}
                <a title="删除" href="javascript:;" onclick="del(this,{$vo.id},'{:\\think\\Url::build(\'Questions/delete\',[\'bankid\'=>$Request.param.bankid,\'btype\'=>$Request.param.btype])}')" class="ml-5" style="text-decoration:none;white-space: nowrap;"><i class="Hui-iconfont"></i>&nbsp;删除</a> 
            </td>
			{/if}

        </tr>
        {/volist}
        </tbody>
    </table>
    <script type="text/javascript">
        //清空当前筛选的数据
        function deldatalist(url){
            layer.confirm("您确定要清空当前筛选数据吗？", {
                btn: ['确定', '取消'],
                title: '提示',
                icon: 3
            }, function () {
                $.get(url, '', function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, {icon: 1, time: 2000});
                        window.location.reload();
                    } else {
                        layer.msg(data.msg, {icon: 1, time: 2000});
                    }
                }, 'json')
            }, function (index) {
                layer.close(index);
            });
            
        }
        //清空当前题库
        function delalldatalist(url){
            layer.confirm("您确定要彻底清空该题库下所有试题吗？", {
                btn: ['确定', '取消'],
                title: '提示',
                icon: 3
            }, function () {
                $.get(url, '', function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, {icon: 1, time: 2000});
                        window.location.reload();
                    } else {
                        layer.msg(data.msg, {icon: 1, time: 2000});
                    }
                }, 'json')
            }, function (index) {
                layer.close(index);
            });
            
        }
    </script>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}

